<?php
class schoolModel extends Model
{
	protected $_validate = array(
		array('title','','此院校已经存在,请检查是否重复',0,'unique',1),
	);
	public function _before_insert(&$data, &$options)
	{
		if(isset($data['attach']))
		{
			$data['attach'] = join(',', $data['attach']);
		}
		else 
		{
			$data['attach'] = '';
		}
	}
	
	public  function _before_update(&$data, &$options){
		$data['attach'] = join(',',$data['attach']);
		if(!isset($_REQUEST['recommend'])) $data['recommend'] = 0;
		
	}
}